package com.kfm.am.split;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class Test {

    public static void main(String[] args) {
        String fileName = "io\\dj.mp4";
        String out = "io\\cutter";
        try (FileInputStream in = new FileInputStream(fileName);) {
            byte[] bytes = in.readAllBytes();
            int size = 1024 * 1024;
            int count = 1;
            for (int i = 0; i < bytes.length; i += size) {
                new SplitFileThread(bytes, i, Math.min(i + size, bytes.length), new File(out, count++ + ".tmp")).start();
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
